import os,tempfile,shutil,commands
import pickle
import sys
import time

def doSetUntilDone(theurl,waittime=2):
    #repeat calling curl until a successfully curl call which will return "True"
    succ=False
    while not succ:
        cmdstr="curl -s \"%s\""%(theurl)
        (status,output)=commands.getstatusoutput(cmdstr)
        print "doSetUntilDone: Running command=%s, status=%d, output=%s"%(cmdstr,status,output)
        if output=="True":
            succ=True
        else:
            time.sleep(waittime)
